﻿using Face8280WebSocketServer.DB.Device;
using Face8280WebSocketServer.DTO;
using Face8280WebSocketServer.DTO.FaceDevice;
using Face8280WebSocketServer.Utility.Model;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace Face8280WebSocketServer.Interface
{
    /// <summary>
    /// 设备操作服务
    /// </summary>
    public interface IFaceDriveService : IBaseService
    {
        DbSet<FaceDeviceDetail> GetDBSet();


      //  public Task<JsonResultModel> AddDevice(AddDeviceParameter parameter);

        /// <summary>
        /// 分页查询设备信息
        /// </summary>
        /// <returns></returns>
        PageResult<FaceDeviceDetail_PageModel> GetDevicePage(List<Expression<Func<FaceDeviceDetail, bool>>> oWheres, BasePageParameter page);

        /// <summary>
        /// 根据SN获取设备在线状态
        /// </summary>
        List<FaceDeviceDetail_PageModel> GetDeviceOnlineStatus(List<string> SNList);

        /// <summary>
        /// 从数据库获取权限统计信息
        /// </summary>
        /// <param name="oDevice"></param>
        (int NewPeople, int DelPeople, int RemoteCount, int AccessTotal) GetTaskTotalByDB(FaceDeviceDetail oDevice);


        /// <summary>
        /// 更新设备信息
        /// </summary>
        /// <param name="oDevice"></param>
        /// <returns></returns>
        JsonResultModel Update(FaceDeviceDetail oDevice);

        /// <summary>
        /// 删除设备
        /// </summary>
        /// <param name="DeviceIDs"></param>
        /// <returns></returns>
        bool Delete(List<int> DeviceIDs);

        /// <summary>
        /// 添加一个新设备
        /// </summary>
        /// <param name="oDevice"></param>
        /// <returns></returns>
        bool Add(FaceDeviceDetail oDevice);

        bool AddNew(DB.NewModel.Device.FaceDeviceDetailNew oDevice);

        /// <summary>
        /// 设置设备出厂默认值
        /// </summary>
        /// <param name="par"></param>
        void SaveDefaultValue(FaceDeviceDetail def);

        /// <summary>
        /// 获取设备默认参数的Json
        /// </summary>
        /// <returns></returns>
        FaceDeviceDetail GetDefaultValue();

        /// <summary>
        /// 执行初始化设备
        /// </summary>
        /// <param name="iDeviceID"></param>
        void FormatDevice(int iDeviceID);

        /// <summary>
        /// 更新设备固件版本
        /// </summary>
        /// <param name="url"></param>
        /// <param name="ver"></param>
        /// <param name="softMD5"></param>
        /// <param name="deviceID"></param>
        void UpdateDeviceSoft(string url, string ver, string softMD5, int deviceID);
    }
}
